/***     
 * SP_ONE_DOUBLE: 2, // 只有一对
 */

var CardGroupType = require('./CardGroupType');
var FindSameCardValueTool = require('../FindTool/FindSameCardValueTool');
var _ = require('../Underscore');
var CardType = require('../CardType');
var CardTool = require('../CardTool');
var FindShunZiTool = require('../FindTool/FindShunZiTool');
var FindPairsTool = require('../FindTool/FindPairsTool');
var GroupFiveAPairs = module.exports = {};

GroupFiveAPairs.getMoreResult = function(_cardInfoList) {
    var resultInfo = FindPairsTool.getResult(_cardInfoList, 1);
    if (resultInfo.isFind) {
        var result = {
            isFind: true,
            findGroupMore: []
        };

        var totalPairs = _.size(resultInfo.findGroup);
        for (var i = 0; i < totalPairs; ++i) {
            var findGroup = resultInfo.findGroup[i];
            var sanCards = _.difference(_cardInfoList, findGroup);
            var sanCardSize = _.size(sanCards);
            findGroup.push(sanCards[sanCardSize - 1]);
            findGroup.push(sanCards[sanCardSize - 2]);
            findGroup.push(sanCards[sanCardSize - 3]);
            var otherGroup = _.difference(sanCards, findGroup);
            var info = {
                findGroup: findGroup,
                otherGroup: otherGroup
            }
            result.findGroupMore.push(info);
        }
        CardTool.LogResult(result, this.getName());
        return result;
    }
    CardTool.LogResult(resultInfo, this.getName());
    return resultInfo;
};

GroupFiveAPairs.getName = function() {
    return '只有一对';
};

GroupFiveAPairs.getType = function() {
    return CardGroupType.SP_ONE_DOUBLE;
}